import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
} from '@nestjs/common'
import { PurchaseService } from './purchase.service'

@Controller('purchase')
export class PurchaseController {
  constructor(private readonly purchaseService: PurchaseService) { }

  @Post('add')
  add(@Body() body) {
    return this.purchaseService.add(body)
  }

  @Post('del')
  del(@Body() body) {
    return this.purchaseService.del(body.id as number)
  }

  @Post('edit')
  edit(@Body() body) {
    return this.purchaseService.update(body)
  }

  @Post('page')
  page(@Body() body) {
    return this.purchaseService.getPageList(body)
  }

  @Post('getPurchaseList')
  getPurchaseList(@Body() body) {
    return this.purchaseService.getPurchaseList(body.isInStore, body.orgId)
  }

  @Post('getPurchaseDetail')
  getPurchaseDetail(@Body() body) {
    return this.purchaseService.getPurchaseDetail(body.id)
  }
}
